{include file="public/header" /}

<div class="crumb_warp">
    <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
    <i class="fa fa-home"></i> <a href="{:url('admin/index/info')}">首页</a> &raquo; 配置列表
</div>
<!--面包屑导航 结束-->

<!--搜索结果页面 列表 开始-->
<form action="" method="post">
    <div class="result_wrap">
        <!--快捷导航 开始-->
        <div class="result_content">
            <div class="result_title">
                <h3>配置管理操作</h3>
            </div>
            <div class="short_wrap">
                <a href="{:url('admin/config/add')}"><i class="fa fa-plus"></i>添加配置</a>
                <a href="{:url('admin/config/index')}"><i class="fa fa-recycle"></i>配置列表</a>
            </div>
        </div>
        <!--快捷导航 结束-->
    </div>

    <div class="result_wrap">
        <div class="result_content">
            <table class="list_tab">
                <tr>
                    <th class="tc">排序</th>
                    <th class="tc">ID</th>
                    <th class="tc">中文名称</th>
                    <th class="tc">英文名称</th>
                    <th>描述</th>
                    <th>内容</th>
                    <th>操作</th>
                </tr>

                {foreach name="list" item="v"}
                <tr>
                    <td class="tc">
                        <input type="text" onchange="changeOrder(this, {$v->id});" name="ord[]" value="{$v->sort_order}">
                    </td>
                    <td class="tc">{$v->id}</td>
                    <td class="tc">{$v->zh_name}</td>
                    <td class="tc">{$v->en_name}</td>
                    <td>{$v->tips}</td>
                    <td>{$v->_html}</td>
                    <td>
                        <a href="{:url('/admin/config/edit/id/'.$v->id)}">修改</a>
                        <a href="javascript:;" onclick="deleteAction('{$v->id}')">删除</a>
                    </td>
                </tr>
                {/foreach}

            </table>

            <div class="btn_group">
                <input type="submit" value="提交">
                <input type="button" class="back" onclick="history.go(-1)" value="返回" >
            </div>

        </div>
    </div>

</form>
<!--搜索结果页面 列表 结束-->
<script>
    function changeOrder(obj, id) {
        var order = $(obj).val();
        $.post("{:url('admin/common/change_order')}",{'type':'config','id':id,'order':order,'field':'sort_order'}, function (data) {
            layer.msg(data.msg);
        },'json')
    }

    function deleteAction(id) {
        //询问框
        layer.confirm('您确定要删除这个配置吗？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            //发送post请求
            $.post("{:url('admin/config/delete')}", {_method:'DELETE','_token':'csrf_token',id:id}, function (data) {
                if(data.errno) {
                    layer.msg(data.msg, {icon: 2});
                }else {
                    layer.msg('删除成功', {icon: 1});
                    location.href=location.href;
                }
            },'json');
        }, function(){
            //layer.msg('11', {icon: 2});
        });
    }
</script>

{include file="public/footer" /}